﻿using AbpEntityFrameworkcore.DbContext;
using AbpToDomain.EntityInfo;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpApplication.Expand
{
    public class QueryDynamic_Box
    {

        private readonly MyDbContext context;

        public QueryDynamic_Box(MyDbContext context)
        {
            this.context = context;
        }

        public List<Box> QueryDynameic(string?BoxCode)
        {

            IQueryable<Box> boxes = context.boxs.Include(x=>x.WarehouseLine);

            if (!string.IsNullOrEmpty(BoxCode))
            {
                boxes = boxes.Where(b => b.BoxCode.Contains(BoxCode));
            }
 
            return boxes.ToList();
        }
    }
}
